<%@page import="school.entity.Student"%>
<%@page import="school.dao.*"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'out.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		ul li:nth-child(even){
			background-color: pink;
		}
	</style>
	<script type="text/javascript">
	 function doClick(){
		 <%
		 	//System.out.println("按钮被点击了。。。");
		 	out.print("alert('刘欢是个大帅哥！');");
		 %>
	 }
	 function confirmDel(s){
		 return confirm("您真的要删除【"+s+"】?");
	 }
	</script>
  </head>
  
  <body>
  <%
    //session.setMaxInactiveInterval(5);
    Student  student=(Student)session.getAttribute("USER_LOGIN");
    if(student==null){
    	out.print("<script>alert('您还没有登录，请登录');location.replace('login.jsp');</script>");
    	return;
    }
  %>
  <h2>欢迎 <%=student.getSname()%> &nbsp;<a href="logout.jsp">退出</a></h2>
 <%--  <input type="button" value="click me" onclick="doClick()"/>
    This is my JSP page. <br>
    <h1>out对象</h1>
    <%
      out.print(out.getClass().getName());
    int []ar={10,20,30,40,60};
    for(int i:ar){
    %>
     <%=i%><br>
    <%} %>
    <ul> --%>
    <%
    	StudentDao dao=new MySqlStudentDao();
    	List<Student> list=dao.query();
    	for(Student s:list){
    	%>
    	 <li><%=s.getStuno()%>=<%=s.getSname() %>&nbsp; <a onclick="return confirmDel('<%=s.getSname() %>')" href="delStu.jsp?stuno=<%=s.getStuno()%>&sname=<%=s.getSname() %>">删除</a></li>
    	<%} %>
    </ul>	
    <%
     System.out.println("这里是jsp的末尾");
    %>
   </body>
   </html> 	